Fermat's theorem (stationary points)

From HandWiki
Short description: Method to find local maxima and minima of differentiable functions on open sets

In mathematics, Fermat's theorem (also known as interior extremum theorem) is a method to find local maxima and minima of differentiable functions on open sets by showing that every local extremum of the function is a stationary point (the function's derivative is zero at that point). Fermat's theorem is a theorem in real analysis, named after Pierre de Fermat.

By using Fermat's theorem, the potential extrema of a function [math]\displaystyle{ \displaystyle f }[/math], with derivative [math]\displaystyle{ \displaystyle f' }[/math], are found by solving an equation in [math]\displaystyle{ \displaystyle f' }[/math]. Fermat's theorem gives only a necessary condition for extreme function values, as some stationary points are inflection points (not a maximum or minimum). The function's second derivative, if it exists, can sometimes be used to determine whether a stationary point is a maximum or minimum.

Statement

One way to state Fermat's theorem is that, if a function has a local extremum at some point and is differentiable there, then the function's derivative at that point must be zero. In precise mathematical language:

Let [math]\displaystyle{ f\colon (a,b) \rightarrow \mathbb{R} }[/math] be a function and suppose that [math]\displaystyle{ x_0 \in (a,b) }[/math] is a point where [math]\displaystyle{ f }[/math] has a local extremum. If [math]\displaystyle{ f }[/math] is differentiable at [math]\displaystyle{ \displaystyle x_0 }[/math], then [math]\displaystyle{ f'(x_0) = 0 }[/math].

Another way to understand the theorem is via the contrapositive statement: if the derivative of a function at any point is not zero, then there is not a local extremum at that point. Formally:

If [math]\displaystyle{ f }[/math] is differentiable at [math]\displaystyle{ x_0 \in (a,b) }[/math], and [math]\displaystyle{ f'(x_0) \neq 0 }[/math], then [math]\displaystyle{ x_0 }[/math] is not a local extremum of [math]\displaystyle{ f }[/math].

Corollary

The global extrema of a function f on a domain A occur only at boundaries, non-differentiable points, and stationary points. If [math]\displaystyle{ x_0 }[/math] is a global extremum of f, then one of the following is true:

  • boundary: [math]\displaystyle{ x_0 }[/math] is in the boundary of A
  • non-differentiable: f is not differentiable at [math]\displaystyle{ x_0 }[/math]
  • stationary point: [math]\displaystyle{ x_0 }[/math] is a stationary point of f

Extension

In higher dimensions, exactly the same statement holds; however, the proof is slightly more complicated. The complication is that in 1 dimension, one can either move left or right from a point, while in higher dimensions, one can move in many directions. Thus, if the derivative does not vanish, one must argue that there is some direction in which the function increases – and thus in the opposite direction the function decreases. This is the only change to the proof or the analysis.

The statement can also be extended to differentiable manifolds. If [math]\displaystyle{ f : M \to \mathbb{R} }[/math] is a differentiable function on a manifold [math]\displaystyle{ M }[/math], then its local extrema must be critical points of [math]\displaystyle{ f }[/math], in particular points where the exterior derivative [math]\displaystyle{ df }[/math] is zero.[1][better source needed]

Applications

Fermat's theorem is central to the calculus method of determining maxima and minima: in one dimension, one can find extrema by simply computing the stationary points (by computing the zeros of the derivative), the non-differentiable points, and the boundary points, and then investigating this set to determine the extrema.

One can do this either by evaluating the function at each point and taking the maximum, or by analyzing the derivatives further, using the first derivative test, the second derivative test, or the higher-order derivative test.

Intuitive argument

Intuitively, a differentiable function is approximated by its derivative – a differentiable function behaves infinitesimally like a linear function [math]\displaystyle{ a+bx, }[/math] or more precisely, [math]\displaystyle{ f(x_0) + f'(x_0)(x-x_0). }[/math] Thus, from the perspective that "if f is differentiable and has non-vanishing derivative at [math]\displaystyle{ x_0, }[/math] then it does not attain an extremum at [math]\displaystyle{ x_0, }[/math]" the intuition is that if the derivative at [math]\displaystyle{ x_0 }[/math] is positive, the function is increasing near [math]\displaystyle{ x_0, }[/math] while if the derivative is negative, the function is decreasing near [math]\displaystyle{ x_0. }[/math] In both cases, it cannot attain a maximum or minimum, because its value is changing. It can only attain a maximum or minimum if it "stops" – if the derivative vanishes (or if it is not differentiable, or if one runs into the boundary and cannot continue). However, making "behaves like a linear function" precise requires careful analytic proof.

More precisely, the intuition can be stated as: if the derivative is positive, there is some point to the right of [math]\displaystyle{ x_0 }[/math] where f is greater, and some point to the left of [math]\displaystyle{ x_0 }[/math] where f is less, and thus f attains neither a maximum nor a minimum at [math]\displaystyle{ x_0. }[/math] Conversely, if the derivative is negative, there is a point to the right which is lesser, and a point to the left which is greater. Stated this way, the proof is just translating this into equations and verifying "how much greater or less".

The intuition is based on the behavior of polynomial functions. Assume that function f has a maximum at x0, the reasoning being similar for a function minimum. If [math]\displaystyle{ \displaystyle x_0 \in (a,b) }[/math] is a local maximum then, roughly, there is a (possibly small) neighborhood of [math]\displaystyle{ \displaystyle x_0 }[/math] such as the function "is increasing before" and "decreasing after"[note 1] [math]\displaystyle{ \displaystyle x_0 }[/math]. As the derivative is positive for an increasing function and negative for a decreasing function, [math]\displaystyle{ \displaystyle f' }[/math] is positive before and negative after [math]\displaystyle{ \displaystyle x_0 }[/math]. [math]\displaystyle{ \displaystyle f' }[/math] does not skip values (by Darboux's theorem), so it has to be zero at some point between the positive and negative values. The only point in the neighbourhood where it is possible to have [math]\displaystyle{ \displaystyle f'(x) = 0 }[/math] is [math]\displaystyle{ \displaystyle x_0 }[/math].

The theorem (and its proof below) is more general than the intuition in that it does not require the function to be differentiable over a neighbourhood around [math]\displaystyle{ \displaystyle x_0 }[/math]. It is sufficient for the function to be differentiable only in the extreme point.

Proof

Proof 1: Non-vanishing derivatives implies not extremum

Suppose that f is differentiable at [math]\displaystyle{ x_0 \in (a,b), }[/math] with derivative K, and assume without loss of generality that [math]\displaystyle{ K \gt 0, }[/math] so the tangent line at [math]\displaystyle{ x_0 }[/math] has positive slope (is increasing). Then there is a neighborhood of [math]\displaystyle{ x_0 }[/math] on which the secant lines through [math]\displaystyle{ x_0 }[/math] all have positive slope, and thus to the right of [math]\displaystyle{ x_0, }[/math] f is greater, and to the left of [math]\displaystyle{ x_0, }[/math] f is lesser.

The schematic of the proof is:

  • an infinitesimal statement about derivative (tangent line) at [math]\displaystyle{ x_0 }[/math] implies
  • a local statement about difference quotients (secant lines) near [math]\displaystyle{ x_0, }[/math] which implies
  • a local statement about the value of f near [math]\displaystyle{ x_0. }[/math]

Formally, by the definition of derivative, [math]\displaystyle{ f'(x_0) = K }[/math] means that

[math]\displaystyle{ \lim_{\varepsilon \to 0} \frac{f(x_0+\varepsilon)-f(x_0)}{\varepsilon} = K. }[/math]

In particular, for sufficiently small [math]\displaystyle{ \varepsilon }[/math] (less than some [math]\displaystyle{ \varepsilon_0 }[/math]), the quotient must be at least [math]\displaystyle{ K/2, }[/math] by the definition of limit. Thus on the interval [math]\displaystyle{ (x_0-\varepsilon_0,x_0+\varepsilon_0) }[/math] one has:

[math]\displaystyle{ \frac{f(x_0+\varepsilon)-f(x_0)}{\varepsilon} \gt K/2; }[/math]

one has replaced the equality in the limit (an infinitesimal statement) with an inequality on a neighborhood (a local statement). Thus, rearranging the equation, if [math]\displaystyle{ \varepsilon \gt 0, }[/math] then:

[math]\displaystyle{ f(x_0+\varepsilon) \gt f(x_0) + (K/2)\varepsilon \gt f(x_0), }[/math]

so on the interval to the right, f is greater than [math]\displaystyle{ f(x_0), }[/math] and if [math]\displaystyle{ \varepsilon \lt 0, }[/math] then:

[math]\displaystyle{ f(x_0+\varepsilon) \lt f(x_0) + (K/2)\varepsilon \lt f(x_0), }[/math]

so on the interval to the left, f is less than [math]\displaystyle{ f(x_0). }[/math]

Thus [math]\displaystyle{ x_0 }[/math] is not a local or global maximum or minimum of f.

Proof 2: Extremum implies derivative vanishes

Alternatively, one can start by assuming that [math]\displaystyle{ \displaystyle x_0 }[/math] is a local maximum, and then prove that the derivative is 0.

Suppose that [math]\displaystyle{ \displaystyle x_0 }[/math] is a local maximum (a similar proof applies if [math]\displaystyle{ \displaystyle x_0 }[/math] is a local minimum). Then there exists [math]\displaystyle{ \delta \gt 0 }[/math] such that [math]\displaystyle{ (x_0 - \delta,x_0 + \delta) \subset (a,b) }[/math] and such that we have [math]\displaystyle{ f(x_0) \ge f(x) }[/math] for all [math]\displaystyle{ x }[/math] with [math]\displaystyle{ \displaystyle |x - x_0| \lt \delta }[/math]. Hence for any [math]\displaystyle{ h \in (0,\delta) }[/math] we have

[math]\displaystyle{ \frac{f(x_0+h) - f(x_0)}{h} \le 0. }[/math]

Since the limit of this ratio as [math]\displaystyle{ \displaystyle h }[/math] gets close to 0 from above exists and is equal to [math]\displaystyle{ \displaystyle f'(x_0) }[/math] we conclude that [math]\displaystyle{ f'(x_0) \le 0 }[/math]. On the other hand, for [math]\displaystyle{ h \in (-\delta,0) }[/math] we notice that

[math]\displaystyle{ \frac{f(x_0+h) - f(x_0)}{h} \ge 0 }[/math]

but again the limit as [math]\displaystyle{ \displaystyle h }[/math] gets close to 0 from below exists and is equal to [math]\displaystyle{ \displaystyle f'(x_0) }[/math] so we also have [math]\displaystyle{ f'(x_0) \ge 0 }[/math].

Hence we conclude that [math]\displaystyle{ \displaystyle f'(x_0) = 0. }[/math]

Cautions

A subtle misconception that is often held in the context of Fermat's theorem is to assume that it makes a stronger statement about local behavior than it does. Notably, Fermat's theorem does not say that functions (monotonically) "increase up to" or "decrease down from" a local maximum. This is very similar to the misconception that a limit means "monotonically getting closer to a point". For "well-behaved functions" (which here means continuously differentiable), some intuitions hold, but in general functions may be ill-behaved, as illustrated below. The moral is that derivatives determine infinitesimal behavior, and that continuous derivatives determine local behavior.

Continuously differentiable functions

If f is continuously differentiable [math]\displaystyle{ \left(C^1\right) }[/math] on an open neighborhood of the point [math]\displaystyle{ x_0 }[/math], then [math]\displaystyle{ f'(x_0) \gt 0 }[/math] does mean that f is increasing on a neighborhood of [math]\displaystyle{ x_0, }[/math] as follows.

If [math]\displaystyle{ f'(x_0) = K \gt 0 }[/math] and [math]\displaystyle{ f \in C^1, }[/math] then by continuity of the derivative, there is some [math]\displaystyle{ \varepsilon_0 \gt 0 }[/math] such that [math]\displaystyle{ f'(x) \gt K/2 }[/math] for all [math]\displaystyle{ x \in (x_0 - \varepsilon_0, x_0 + \varepsilon_0) }[/math]. Then f is increasing on this interval, by the mean value theorem: the slope of any secant line is at least [math]\displaystyle{ K/2, }[/math] as it equals the slope of some tangent line.

However, in the general statement of Fermat's theorem, where one is only given that the derivative at [math]\displaystyle{ x_0 }[/math] is positive, one can only conclude that secant lines through [math]\displaystyle{ x_0 }[/math] will have positive slope, for secant lines between [math]\displaystyle{ x_0 }[/math] and near enough points.

Conversely, if the derivative of f at a point is zero ([math]\displaystyle{ x_0 }[/math] is a stationary point), one cannot in general conclude anything about the local behavior of f – it may increase to one side and decrease to the other (as in [math]\displaystyle{ x^3 }[/math]), increase to both sides (as in [math]\displaystyle{ x^4 }[/math]), decrease to both sides (as in [math]\displaystyle{ -x^4 }[/math]), or behave in more complicated ways, such as oscillating (as in [math]\displaystyle{ x^2 \sin(1/x) }[/math], as discussed below).

One can analyze the infinitesimal behavior via the second derivative test and higher-order derivative test, if the function is differentiable enough, and if the first non-vanishing derivative at [math]\displaystyle{ x_0 }[/math] is a continuous function, one can then conclude local behavior (i.e., if [math]\displaystyle{ f^{(k)}(x_0) \neq 0 }[/math] is the first non-vanishing derivative, and [math]\displaystyle{ f^{(k)} }[/math] is continuous, so [math]\displaystyle{ f \in C^k }[/math]), then one can treat f as locally close to a polynomial of degree k, since it behaves approximately as [math]\displaystyle{ f^{(k)}(x_0) (x - x_0)^k, }[/math] but if the k-th derivative is not continuous, one cannot draw such conclusions, and it may behave rather differently.

Pathological functions

The function [math]\displaystyle{ \sin(1/x) }[/math] oscillates increasingly rapidly between [math]\displaystyle{ -1 }[/math] and [math]\displaystyle{ 1 }[/math] as x approaches 0. Consequently, the function [math]\displaystyle{ f(x) = (1 + \sin(1/x))x^2 }[/math] oscillates increasingly rapidly between 0 and [math]\displaystyle{ 2x^2 }[/math] as x approaches 0. If one extends this function by defining [math]\displaystyle{ f(0) = 0 }[/math] then the extended function is continuous and everywhere differentiable (it is differentiable at 0 with derivative 0), but has rather unexpected behavior near 0: in any neighborhood of 0 it attains 0 infinitely many times, but also equals [math]\displaystyle{ 2x^2 }[/math] (a positive number) infinitely often.

Continuing in this vein, one may define [math]\displaystyle{ g(x) = (2 + \sin(1/x))x^2 }[/math], which oscillates between [math]\displaystyle{ x^2 }[/math] and [math]\displaystyle{ 3x^2 }[/math]. The function has its local and global minimum at [math]\displaystyle{ x=0 }[/math], but on no neighborhood of 0 is it decreasing down to or increasing up from 0 – it oscillates wildly near 0.

This pathology can be understood because, while the function g is everywhere differentiable, it is not continuously differentiable: the limit of [math]\displaystyle{ g'(x) }[/math] as [math]\displaystyle{ x \to 0 }[/math] does not exist, so the derivative is not continuous at 0. This reflects the oscillation between increasing and decreasing values as it approaches 0.

See also

Notes

  1. This intuition is only correct for continuously differentiable [math]\displaystyle{ \left(C^1\right) }[/math] functions, while in general it is not literally correct—a function need not be increasing up to a local maximum: it may instead be oscillating, so neither increasing nor decreasing, but simply the local maximum is greater than any values in a small neighborhood to the left or right of it. See details in the pathologies.

References

External links